2
实验 4:优化对抗搜索
PolyU COMP55112026-02-2

启发式 1:位置策略

A standard Minimax AI only knows it has won when it forms 5-in-a-row. Until that very last moment, every spot on the board often looks "equal" (score 0), causing it to move randomly in the early game.

核心概念

  • 并非所有空位都同等重要。 A stone played in the corner is weak; it has fewer directions to expand.
  • 一枚落在 中心 is powerful. It controls vertical, horizontal, and diagonal lines simultaneously.
  • 目标: Encourage the AI to control the center even before it sees a winning line.

实现方式:「热力图」

Instead of calculating "centrality" geometry in real-time (which is slow), we pre-define a 查找表.

This is a 2D matrix matching the board size. Higher numbers indicate more valuable strategic positions. When evaluate_board runs, we simply look up the value for every stone the AI has placed.